import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PayConfigVO, PayConfigForm, PayConfigQuery } from '@/api/primary/payConfig/types';

/**
 * 查询支付配置列表
 * @param query
 * @returns {*}
 */

export const listPayConfig = (query?: PayConfigQuery): AxiosPromise<PayConfigVO[]> => {
  return request({
    url: '/primary/payConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询支付配置详细
 * @param id
 */
export const getPayConfig = (id: string | number): AxiosPromise<PayConfigVO> => {
  return request({
    url: '/primary/payConfig/' + id,
    method: 'get'
  });
};

/**
 * 新增支付配置
 * @param data
 */
export const addPayConfig = (data: PayConfigForm) => {
  return request({
    url: '/primary/payConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改支付配置
 * @param data
 */
export const updatePayConfig = (data: PayConfigForm) => {
  return request({
    url: '/primary/payConfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除支付配置
 * @param id
 */
export const delPayConfig = (id: string | number | Array<string | number>) => {
  return request({
    url: '/primary/payConfig/' + id,
    method: 'delete'
  });
};
